package org.groupg.practice.tablesaw;

import tech.tablesaw.api.Table;
import tech.tablesaw.io.csv.CsvReadOptions;

import java.io.File;
import java.io.IOException;
import java.net.URL;

public class LoadDataExample {
    public static void main(String[] args) throws IOException {
        File file = new File("F:\\DATA\\demo\\sys_user50w.csv");
        Table table = Table.read().csv(file);
        System.out.println(table.shape());  // 打印表的形状 (行数和列数)
        System.out.println(table.first(10));  // 打印前 10 行数据

        URL url = new URL(file.getPath());
            CsvReadOptions options = CsvReadOptions.builder(url).header(true).build();
            Table table1 = Table.read().usingOptions(options);
            System.out.println(table1.shape());  // 打印表的形状 (行数和列数)
            System.out.println(table1.first(10));  // 打印前 10 行数据
    }
}